package biolabs.core;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Marker annotation for attributes of bio-objects.
 * {@code @Attribute} can be used on public fields and public
 * getter and setter methods.
 *
 * <p>Each attribute has a name. The name can be provided in the optional
 * {@link #name()} parameter. If omitted, default name is used: for field
 * attributes, the name of the field becomes the attribute name; for method
 * attributes, the method name without the "get"/"set" prefix and the first
 * letter converted to lower-case becomes the attribute name.</p>
 *
 * <p>If only a getter method is provided for an attribute, the attribute
 * is considered read-only. If only a setter method is provided, it is
 * considered write-only.</p>
 *
 * <p>Attribute getters and setters may not throw checked exceptions.</p>
 *
 * @author Tomas Mikula
 */
@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Attribute {

	/**
	 * Optional name of the attribute.
	 */
	String name() default "";
}
